 package se.superduperbudget.superbudgetuser;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class TargetServlet extends HttpServlet {
    private static final String CONTENT_TYPE = "text/html";

    
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        
        PrintWriter out = response.getWriter();
        if(request.getParameter("action").equals("tja"))
        {
            out.println("tja!");
            System.out.println("tja");
        }
        
        
    }
    
    @Override
    public void doPost(HttpServletRequest request,
		       HttpServletResponse response) throws ServletException,
		       IOException {
	System.out.println("en post!");
        response.setContentType(CONTENT_TYPE);
        
        PrintWriter out = response.getWriter();

        
        System.out.println("Target början---------------------");
        ServletInputStream inputStream = request.getInputStream();
        BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
        String line = null;
        while((line = in.readLine()) != null) {
            System.out.println(line);
        }
        System.out.println("Target slut ---------------------");
        out.print("true");
        out.close();
    }
}